package com.xinchen.aiowaste.ui.activity

import android.os.Bundle
import com.hjq.permissions.XXPermissions
import com.maple.base.base.BaseActivity
import com.maple.utils.util.PermissionUtils
import com.maple.utils.util.RequestPermissionResult
import com.xinchen.aiowaste.R

class SplashActivity : BaseActivity() {

    override fun getLayoutId(): Int = R.layout.activity_splash

    override fun initData(savedInstanceState: Bundle?) {

        PermissionUtils.applyPermissionsByAio(this,object :RequestPermissionResult{
            override fun onRequestPermissionSuccess() {
                onStartActivity(AccountActivity::class.java, isFinish = true)
//                onStartActivity(WasteListActivity::class.java, isFinish = true)
//                onStartActivity(LabelListActivity::class.java, isFinish = true)
//                onStartActivity(SystemSettingActivity::class.java, isFinish = true)
            }

            override fun onRequestPermissionFailure(permissions: List<String>) {
                super.onRequestPermissionFailure(permissions)
                onFinish()
            }

            override fun onRequestPermissionFailureWithAskNeverAgain(permissions: List<String>) {
                super.onRequestPermissionFailureWithAskNeverAgain(permissions)
                XXPermissions.startPermissionActivity(this@SplashActivity, permissions)
            }
        })
    }
}